package com.biz.primus.ms.order.coupon.service.impl;

import com.biz.primus.model.order.coupon.vo.consume.QueryCanUseCouponReqVO;
import com.biz.primus.model.order.coupon.vo.consume.QueryCanUseCouponRespVO;
import com.biz.primus.ms.order.coupon.service.DiscountCouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

/**
 * 优惠券服务实现
 *  惠Go-券平台-消费终端API
 *
 * @author Tiger Feng
 * @date 2017年11月15日
 */
public class DiscountCouponServiceImpl implements DiscountCouponService {
    @Autowired
    private RestTemplate restTemplate;

    /**
     * 1.3.	订单可用券查询
     *
     * @param queryCanUseCouponReqVO
     * @return
     */
    @Override
    public QueryCanUseCouponRespVO queryCanUseCoupon(QueryCanUseCouponReqVO queryCanUseCouponReqVO) {
        ResponseEntity<QueryCanUseCouponRespVO> respVOResponseEntity = restTemplate.postForEntity(
                URL.QUERY_CAN_USE_COUPON_LIST,
                queryCanUseCouponReqVO,
                QueryCanUseCouponRespVO.class);
        return respVOResponseEntity.getBody();
    }

    /**
     * 优惠券请求接口地址集
     */
    public class URL {
        private final static String DISCOUNT_COUPON_SERVER = "http://HOST:PORT";
        private final static String QUERY_CAN_USE_COUPON_LIST = DISCOUNT_COUPON_SERVER + "/omp-event-webin/rest?method=efuture.omp.event.couponuse.get&ent_id=0";


    }

}
